<!DOCTYPE HTML>
<html lang="en">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="2.yolov5+tensorrt+deepstream, Hexo">
    <meta name="description" content="目录

介绍
环境
电脑上
jetson上
搭建yolov5的环境
克隆tensorrtx


安装测试deepstream（5.0）
安装ds-6.0
yolov5检测


在ds中调用csi or usb摄像头
插件配置
视频输入
ca">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="referrer" content="no-referrer-when-downgrade">
    <!-- Global site tag (gtag.js) - Google Analytics -->


    <title>2.yolov5+tensorrt+deepstream | Hexo</title>
    <link rel="icon" type="image/png" href="/favicon.png">
    


    <!-- bg-cover style     -->



<link rel="stylesheet" type="text/css" href="/libs/awesome/css/all.min.css">
<link rel="stylesheet" type="text/css" href="/libs/materialize/materialize.min.css">
<link rel="stylesheet" type="text/css" href="/libs/aos/aos.css">
<link rel="stylesheet" type="text/css" href="/libs/animate/animate.min.css">
<link rel="stylesheet" type="text/css" href="/libs/lightGallery/css/lightgallery.min.css">
<link rel="stylesheet" type="text/css" href="/css/matery.css">
<link rel="stylesheet" type="text/css" href="/css/my.css">
<link rel="stylesheet" type="text/css" href="/css/dark.css" media="none" onload="if(media!='all')media='all'">




    <link rel="stylesheet" href="/libs/tocbot/tocbot.css">
    <link rel="stylesheet" href="/css/post.css">




    
        <link rel="stylesheet" type="text/css" href="/css/reward.css">
    



    <script src="/libs/jquery/jquery-3.6.0.min.js"></script>

<meta name="generator" content="Hexo 7.1.1"></head>


<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
            <div class="brand-logo">
                <a href="/" class="waves-effect waves-light">
                    
                    <img src="/medias/logo.png" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">Hexo</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>Index</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>Tags</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/categories" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>Categories</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>Archives</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>About</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/contact" class="waves-effect waves-light">
      
      <i class="fas fa-comments" style="zoom: 0.6;"></i>
      
      <span>Contact</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/friends" class="waves-effect waves-light">
      
      <i class="fas fa-address-book" style="zoom: 0.6;"></i>
      
      <span>Friends</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="Search" style="zoom: 0.85;"></i>
    </a>
  </li>
  <li>
    <a href="javascript:;" class="waves-effect waves-light" onclick="switchNightMode()" title="深色/浅色模式" >
      <i id="sum-moon-icon" class="fas fa-sun" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>


<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/medias/logo.png" class="logo-img circle responsive-img">
        
        <div class="logo-name">Hexo</div>
        <div class="logo-desc">
            
            Never really desperate, only the lost of the soul.
            
        </div>
    </div>

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			Index
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			Tags
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			Categories
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			Archives
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			About
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/contact" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			Contact
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/friends" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-address-book"></i>
			
			Friends
		</a>
          
        </li>
        
        
        <li><div class="divider"></div></li>
        <li>
            <a href="https://github.com/blinkfox/hexo-theme-matery" class="waves-effect waves-light" target="_blank">
                <i class="fab fa-github-square fa-fw"></i>Fork Me
            </a>
        </li>
        
    </ul>
</div>


        </div>

        
            <style>
    .nav-transparent .github-corner {
        display: none !important;
    }

    .github-corner {
        position: absolute;
        z-index: 10;
        top: 0;
        right: 0;
        border: 0;
        transform: scale(1.1);
    }

    .github-corner svg {
        color: #0f9d58;
        fill: #fff;
        height: 64px;
        width: 64px;
    }

    .github-corner:hover .octo-arm {
        animation: a 0.56s ease-in-out;
    }

    .github-corner .octo-arm {
        animation: none;
    }

    @keyframes a {
        0%,
        to {
            transform: rotate(0);
        }
        20%,
        60% {
            transform: rotate(-25deg);
        }
        40%,
        80% {
            transform: rotate(10deg);
        }
    }
</style>

<a href="https://github.com/blinkfox/hexo-theme-matery" class="github-corner tooltipped hide-on-med-and-down" target="_blank"
   data-tooltip="Fork Me" data-position="left" data-delay="50">
    <svg viewBox="0 0 250 250" aria-hidden="true">
        <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
        <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
              fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
        <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
              fill="currentColor" class="octo-body"></path>
    </svg>
</a>
        
    </nav>

</header>

    



<div class="bg-cover pd-header post-cover" style="background-image: url('/medias/featureimages/21.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">2.yolov5+tensorrt+deepstream</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                          <div class="article-tag">
                            <span class="chip bg-color">No tag</span>
                          </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>Publish Date:&nbsp;&nbsp;
                    2024-02-13
                </div>
                

                

                

                

                
            </div>
        </div>
        <hr class="clearfix">

        

        

        <div class="card-content article-card-content">
            <div id="articleContent">
                <p>目录</p>
<ul>
<li><a href="#%E4%BB%8B%E7%BB%8D">介绍</a></li>
<li><a href="#%E7%8E%AF%E5%A2%83">环境</a></li>
<li><a href="#%E7%94%B5%E8%84%91%E4%B8%8A">电脑上</a></li>
<li><a href="#jetson%E4%B8%8A">jetson上</a><ul>
<li><a href="#%E6%90%AD%E5%BB%BAyolov5%E7%9A%84%E7%8E%AF%E5%A2%83">搭建yolov5的环境</a></li>
<li><a href="#%E5%85%8B%E9%9A%86tensorrtx">克隆tensorrtx</a></li>
</ul>
</li>
<li><a href="#%E5%AE%89%E8%A3%85%E6%B5%8B%E8%AF%95deepstream50">安装测试deepstream（5.0）</a><ul>
<li><a href="#%E5%AE%89%E8%A3%85ds-60">安装ds-6.0</a></li>
<li><a href="#yolov5%E6%A3%80%E6%B5%8B">yolov5检测</a></li>
</ul>
</li>
<li><a href="#%E5%9C%A8ds%E4%B8%AD%E8%B0%83%E7%94%A8csi-or-usb%E6%91%84%E5%83%8F%E5%A4%B4">在ds中调用csi or usb摄像头</a></li>
<li><a href="#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE">插件配置</a><ul>
<li><a href="#%E8%A7%86%E9%A2%91%E8%BE%93%E5%85%A5">视频输入</a><ul>
<li><a href="#camera">camera</a></li>
<li><a href="#videofile">videofile</a></li>
<li><a href="#media-stream">media stream</a></li>
<li><a href="#%E5%A4%9A%E8%B7%AFusb">多路USB</a></li>
<li><a href="#%E5%A4%9A%E8%B7%AFcsi">多路CSI</a></li>
</ul>
</li>
<li><a href="#%E8%A7%86%E9%A2%91%E5%A4%84%E7%90%86">视频处理</a><ul>
<li><a href="#%E7%89%A9%E4%BD%93%E6%A3%80%E6%B5%8B">物体检测</a></li>
<li><a href="#%E7%89%A9%E4%BD%93%E8%B7%9F%E8%B8%AA">物体跟踪</a></li>
<li><a href="#%E6%A3%80%E6%B5%8B%E5%90%8E%E7%9A%84%E5%85%B7%E4%BD%93%E5%88%86%E7%B1%BB">检测后的具体分类</a></li>
</ul>
</li>
<li><a href="#%E8%A7%86%E9%A2%91%E8%BE%93%E5%87%BA">视频输出</a><ul>
<li><a href="#%E5%A4%9A%E8%B7%AF%E5%90%88%E5%B9%B6">多路合并</a></li>
<li><a href="#screen">screen</a></li>
<li><a href="#videofile-1">videofile</a></li>
<li><a href="#media-stream-1">media stream</a></li>
<li><a href="#osd">osd</a></li>
<li><a href="#streammux">streammux</a></li>
</ul>
</li>
<li><a href="#sample%E4%BE%8B%E7%A8%8B">Sample例程</a></li>
</ul>
</li>
<li><a href="#%E9%83%A8%E7%BD%B2%E8%87%AA%E5%B7%B1%E7%9A%84%E6%A8%A1%E5%9E%8B">部署自己的模型</a></li>
<li><a href="#references">References</a><ul>
<li><a href="#%E9%83%A8%E7%BD%B2">部署</a></li>
<li><a href="#deepstream">deepstream</a></li>
</ul>
</li>
</ul>
<h1 id="介绍"><a href="#介绍" class="headerlink" title="介绍"></a>介绍</h1><p>在主机上训练自己的Yolov5模型，转为TensorRT模型并部署到Jetson Nano上，用DeepStream运行。（先以yolov5s.pt为例）</p>
<h1 id="环境"><a href="#环境" class="headerlink" title="环境"></a>环境</h1><p>硬件环境：</p>
<ul>
<li><p>带cuda的显卡主机</p>
</li>
<li><p>Jetson Nano 4G B01</p>
</li>
<li><p>csi摄像头、usb摄像头</p>
</li>
</ul>
<p>软件环境：</p>
<ul>
<li>yolov5-5.0</li>
<li>jetpack-4.4</li>
<li>deepstream-5.0</li>
<li>Tensorrt-7.1</li>
<li>Cuda-10.2</li>
</ul>
<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227222344603.png" alt="image-20220227222344603" width="500" />

<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227222435137.png" alt="image-20220227222435137" width="500" />

<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227222508150.png" alt="image-20220227222508150" width="500" />





<h1 id="电脑上"><a href="#电脑上" class="headerlink" title="电脑上"></a>电脑上</h1><ul>
<li>下载yolov5</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">$ git <span class="built_in">clone</span> -b v5.0 https://github.com/ultralytics/yolov5.git</span><br><span class="line">$ git <span class="built_in">clone</span> -b yolov5-v5.0 https://github.com/wang-xinyu/tensorrtx.git</span><br></pre></td></tr></table></figure>

<p>官方教程文档：</p>
<p><a target="_blank" rel="noopener" href="https://github.com/wang-xinyu/tensorrtx/tree/yolov5-v5.0/yolov5">tensorrtx&#x2F;yolov5 at yolov5-v5.0 · wang-xinyu&#x2F;tensorrtx (github.com)</a></p>
<ul>
<li>若电脑上无法转engine在jetson也可以操作</li>
</ul>
<h1 id="jetson上"><a href="#jetson上" class="headerlink" title="jetson上"></a>jetson上</h1><h2 id="搭建yolov5的环境"><a href="#搭建yolov5的环境" class="headerlink" title="搭建yolov5的环境"></a>搭建yolov5的环境</h2><p>git clone <a target="_blank" rel="noopener" href="https://github.com/ultralytics/yolov5.git">https://github.com/ultralytics/yolov5.git</a></p>
<p>python3 -m pip install –upgrade pip</p>
<p>进入yolov5的项目里</p>
<p>pip3 install -r requirements</p>
<p>若出现pillow相关报错：pillow需要pip3 uninstall重新pip3 install pillow</p>
<h2 id="克隆tensorrtx"><a href="#克隆tensorrtx" class="headerlink" title="克隆tensorrtx"></a>克隆tensorrtx</h2><p>仓库： <a target="_blank" rel="noopener" href="https://github.com/wang-xinyu/tensorrtx.git">https://github.com/wang-xinyu/tensorrtx.git</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> https://github.com/wang-xinyu/tensorrtx.git</span><br></pre></td></tr></table></figure>

<p>将生成的.wts放到tensorrtx&#x2F;yolov5&#x2F;下</p>
<p>若是自己训练的模型需修改<code>tensorrtx/yolov5/yololayer.h</code></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">static constexpr int CLASS_NUM = 80</span><br></pre></td></tr></table></figure>

<p>编译代码</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> &#123;tensorrtx&#125;/yolov5/</span><br><span class="line"><span class="built_in">mkdir</span> build</span><br><span class="line"><span class="built_in">cd</span> build</span><br><span class="line"><span class="built_in">cp</span> &#123;ultralytics&#125;/yolov5/yolov5s.wts &#123;tensorrtx&#125;/yolov5/build</span><br><span class="line">cmake ..</span><br><span class="line">make</span><br></pre></td></tr></table></figure>

<p>将生成的.wts文件转为.engine文件</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo ./yolov5 -s yolov5s.wts yolov5s.engine s</span><br></pre></td></tr></table></figure>

<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220405204625542.png" alt="image-20220405204625542" width="500" />

<p>将要测试的图片放到tensorrtx&#x2F;yolov5&#x2F;samples&#x2F;下，测试能否检测目标</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">sudo ./yolov5 -d ../best.engine ../samples</span><br></pre></td></tr></table></figure>

<p>经过测试转成tensorrt后推理速度大幅加快</p>
<p>图片大小：640*640</p>
<ul>
<li>Yolov5.s推理速度在130ms左右</li>
</ul>
<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220310143041733.png" alt="image-20220310143041733" width="500"  />

<ul>
<li>转换成tensorrt后的推理速度在70ms左右</li>
</ul>
<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220310143135601.png" alt="image-20220310143135601" width="500" />

<h1 id="安装测试deepstream（5-0）"><a href="#安装测试deepstream（5-0）" class="headerlink" title="安装测试deepstream（5.0）"></a>安装测试deepstream（5.0）</h1><p>:bangbang:<strong>一定要在官方文档中查看deepstream和jetpack相对应的版本，如Jetpack 4.6 support Deepstream 6.0</strong></p>
<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220302114638745.png" alt="image-20220302114638745"  width="500" />

<p>官方文档：<a target="_blank" rel="noopener" href="https://docs.nvidia.com/metropolis/#page/DeepStream_Plugin_Manual/deepstream_plugin_faq.html%23wwpID0EGHA">NVIDIA Metropolis Documentation</a></p>
<p>官网下载：<a target="_blank" rel="noopener" href="https://developer.nvidia.com/deepstream-getting-started">DeepStream Getting Started | NVIDIA Developer</a></p>
<p>老版本：<a target="_blank" rel="noopener" href="https://developer.nvidia.com/embedded/deepstream-on-jetson-downloads-archived">NVIDIA DeepStream SDK on Jetson (Archived) | NVIDIA Developer</a></p>
<ul>
<li>精简版笔记</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt install \</span><br><span class="line">    libssl1.0.0 \</span><br><span class="line">    libgstreamer1.0-0 \</span><br><span class="line">    gstreamer1.0-tools \</span><br><span class="line">    gstreamer1.0-plugins-good \</span><br><span class="line">    gstreamer1.0-plugins-bad \</span><br><span class="line">    gstreamer1.0-plugins-ugly \</span><br><span class="line">    gstreamer1.0-libav \</span><br><span class="line">    libgstrtspserver-1.0-0 \</span><br><span class="line">    libjansson4=2.11-1</span><br><span class="line">$ sudo apt-get install librdkafka1=0.11.3-1build1</span><br><span class="line">$ tar -xpvf deepstream_sdk_v4.0.2_jetson.tbz2</span><br><span class="line">$ <span class="built_in">cd</span> deepstream_sdk_v4.0.2_jetson</span><br><span class="line">$ sudo tar -xvpf binaries.tbz2 -C /</span><br><span class="line">$ sudo ./install.sh</span><br><span class="line">$ sudo ldconfig</span><br></pre></td></tr></table></figure>



<ul>
<li>详细版</li>
</ul>
<ol>
<li>安装测试ds(官方release有详细文档)</li>
</ol>
<p>安装软件包</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">sudo apt install \</span><br><span class="line">libssl1.0.0 \</span><br><span class="line">libgstreamer1.0-0 \</span><br><span class="line">gstreamer1.0-tools \</span><br><span class="line">gstreamer1.0-plugins-good \</span><br><span class="line">gstreamer1.0-plugins-bad \</span><br><span class="line">gstreamer1.0-plugins-ugly \</span><br><span class="line">gstreamer1.0-libav \</span><br><span class="line">libgstrtspserver-1.0-0 \</span><br><span class="line">libjansson4=2.11-1</span><br></pre></td></tr></table></figure>

<ol start="2">
<li><p>下载sdk放入jetson</p>
</li>
<li><p>提取解压sdk</p>
</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">sudo tar -xvf deepstream_sdk_v5.1.0_jetson.tbz2 -C /</span><br><span class="line"><span class="built_in">cd</span> /opt/nvidia/deepstream/deepstream-5.1</span><br><span class="line">sudo ./install.sh</span><br><span class="line">sudo ldconfig</span><br></pre></td></tr></table></figure>

<ol start="4">
<li>安装完成后测试</li>
</ol>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> /opt/nvidia/deepstream/deepstream-5.0/samples/configs/deepstream-app/</span><br></pre></td></tr></table></figure>

<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">deepstream-app -c source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt</span><br></pre></td></tr></table></figure>





<h2 id="安装ds-6-0"><a href="#安装ds-6-0" class="headerlink" title="安装ds-6.0"></a>安装ds-6.0</h2><p><a target="_blank" rel="noopener" href="https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Quickstart.html#jetson-setup">Quickstart Guide — DeepStream 6.0 Release documentation (nvidia.com)</a></p>
<p><a target="_blank" rel="noopener" href="https://github.com/rscgg37248/DeepStream6.0_Yolov5-6.0">rscgg37248&#x2F;DeepStream6.0_Yolov5-6.0: 基于DeepStream6.0和yolov5-6.0的目标检测 (github.com)</a></p>
<ul>
<li>Install</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">$ sudo apt install \</span><br><span class="line">libssl1.0.0 \</span><br><span class="line">libgstreamer1.0-0 \</span><br><span class="line">gstreamer1.0-tools \</span><br><span class="line">gstreamer1.0-plugins-good \</span><br><span class="line">gstreamer1.0-plugins-bad \</span><br><span class="line">gstreamer1.0-plugins-ugly \</span><br><span class="line">gstreamer1.0-libav \</span><br><span class="line">libgstrtspserver-1.0-0 \</span><br><span class="line">libjansson4=2.11-1</span><br><span class="line"></span><br><span class="line">$ sudo tar -xvf deepstream_sdk_v6.0.0_jetson.tbz2 -C /</span><br><span class="line">$ <span class="built_in">cd</span> /opt/nvidia/deepstream/deepstream-6.0</span><br><span class="line">$ sudo ./install.sh</span><br><span class="line">$ sudo ldconfig</span><br></pre></td></tr></table></figure>

<ul>
<li>Test</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ <span class="built_in">cd</span> /opt/nvidia/deepstream/deepstream-6.0/samples/configs/deepstream-app/</span><br><span class="line"></span><br><span class="line">$ deepstream-app -c source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt</span><br></pre></td></tr></table></figure>





<h2 id="yolov5检测"><a href="#yolov5检测" class="headerlink" title="yolov5检测"></a>yolov5检测</h2><p>:bangbang:<strong>Jetson nano的系统版本是4.5.1 TensorRT版本7.x yolov5版本 5.0 pillow需要pip3 uninstall重新pip3 install pillow</strong></p>
<p>安装完ds后在&#x2F;opt&#x2F;nvidia&#x2F;deepstream&#x2F;deepstream-5.0&#x2F;sources&#x2F;objectDetector_Yolo会有一个部署yolo的官方实例代码，但只有yolov3的。</p>
<p>github上有已经改好yolov5的项目：<a target="_blank" rel="noopener" href="https://github.com/DanaHan/Yolov5-in-Deepstream-5.0">DanaHan&#x2F;Yolov5-in-Deepstream-5.0: Describe how to use yolov5 in Deepstream 5.0 (github.com)</a></p>
<p>我使用的tensorrt7的版本在里面有适配的分支：<a target="_blank" rel="noopener" href="https://github.com/Abandon-ht/Yolov5-in-Deepstream-5.0/tree/tensorrt7">Abandon-ht&#x2F;Yolov5-in-Deepstream-5.0 at tensorrt7 (github.com)</a></p>
<p>克隆项目</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git <span class="built_in">clone</span> https://github.com/DanaHan/Yolov5-in-Deepstream-5.0.git</span><br></pre></td></tr></table></figure>

<p>测试</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"><span class="built_in">cd</span> Yolov5-in-Deepstream-5.0/Deepstream 5.0</span><br><span class="line"></span><br><span class="line"><span class="comment">#复制coco数据集的labels</span></span><br><span class="line"><span class="built_in">cp</span> ~/darknet/data/coco.names ./labels.txt</span><br><span class="line"></span><br><span class="line"><span class="comment">#复制之前生成的引擎文件到当前目录</span></span><br><span class="line"><span class="built_in">cp</span> ~/tensorrtx/yolov5/build/yolov5s.engine ./</span><br><span class="line"></span><br><span class="line"><span class="built_in">cd</span> nvdsinfer_custom_impl_Yolo</span><br><span class="line"></span><br><span class="line"><span class="comment"># 生成libnvdsinfer_custom_impl_Yolo.so文件</span></span><br><span class="line">make -j</span><br><span class="line"></span><br><span class="line"><span class="comment">#返回到DeepStream5.0/下</span></span><br><span class="line"><span class="built_in">cd</span> ..</span><br><span class="line"></span><br><span class="line"><span class="comment">#测试</span></span><br><span class="line">LD_PRELOAD=./libmyplugins.so deepstream-app -c deepstream_app_config_yoloV5.txt</span><br></pre></td></tr></table></figure>

<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220227180343701.png" alt="image-20220227180343701" style="zoom: 25%;" />

<h1 id="在ds中调用csi-or-usb摄像头"><a href="#在ds中调用csi-or-usb摄像头" class="headerlink" title="在ds中调用csi or usb摄像头"></a>在ds中调用csi or usb摄像头</h1><p>参考资料<a target="_blank" rel="noopener" href="http://www.elecfans.com/d/1677110.html">如何在deepstream-app里调用USB与CSI摄像头-电子发烧友网 (elecfans.com)</a></p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">#安装v4l-utils</span></span><br><span class="line">apt-get install v4l-utils</span><br><span class="line"></span><br><span class="line"><span class="comment">#查看摄像头信息</span></span><br><span class="line">v4l2-ctl --list-devices</span><br></pre></td></tr></table></figure>



<p>查看摄像头可用分辨率</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">v4l2-ctl --list-formats-ext --device=0</span><br><span class="line">v4l2-ctl --list-formats-ext --device=1</span><br></pre></td></tr></table></figure>



<p>修改deepstream_app_config_yoloV5.txt的source</p>
<p>我个人使用的是罗技的<code>c920</code>摄像头（usb）</p>
<p>参数如下</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line"><span class="built_in">enable</span>=1</span><br><span class="line"><span class="comment">#Type - 1=CameraV4L2 2=URI 3=MultiURI</span></span><br><span class="line"><span class="built_in">type</span>=1</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-v4l2-dev-node=0</span><br><span class="line"><span class="comment">#uri=file://../../samples/streams/sample_1080p_h264.mp4</span></span><br><span class="line">num-sources=1</span><br><span class="line">gpu-id=0</span><br><span class="line"><span class="comment"># (0): memtype_device   - Memory type Device</span></span><br><span class="line"><span class="comment"># (1): memtype_pinned   - Memory type Host Pinned</span></span><br><span class="line"><span class="comment"># (2): memtype_unified  - Memory type Unified</span></span><br><span class="line">cudadec-memtype=0</span><br></pre></td></tr></table></figure>

<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/C2A46195D3579CC5DBF107815D2DB515.jpg" alt="C2A46195D3579CC5DBF107815D2DB515" style="zoom:25%;" />





<h1 id="插件配置"><a href="#插件配置" class="headerlink" title="插件配置"></a>插件配置</h1><p>参考deepstream_sdk_v4.0.2_jetson&#x2F;samples&#x2F;configs&#x2F;deepstream-app&#x2F;下的配置文件:</p>
<ul>
<li><p>source30_1080p_resnet_dec_infer_tiled_display_int8.txt：演示具有主要推理功能的30个流解码。（仅适用于dGPU和Jetson AGX Xavier平台。）</p>
</li>
<li><p>source4_1080p_resnet_dec_infer_tiled_display_int8.txt：演示具有主要推理，对象跟踪和三个不同辅助分类器的四个流解码。（仅适用于dGPU和Jetson AGX Xavier平台。）</p>
</li>
<li><p>source4_1080p_resnet_dec_infer_tracker_sgie_tiled_display_int8_gpu1.txt：在GPU 1上针对主要推理，对象跟踪和三个不同的二级分类器演示四个流解码（对于具有多个GPU卡的系统）。仅适用于dGPU平台。</p>
</li>
<li><p>config_infer_primary.txt：将 nvinfer元素配置为主要检测器。</p>
</li>
<li><p>config_infer_secondary_carcolor.txt， config_infer_secondary_carmake.txt， config_infer_secondary_vehicletypes.txt：将 nvinfer元素配置为辅助分类器。</p>
</li>
<li><p>iou_config.txt：配置一个低级的IOU（联合路口）跟踪器。</p>
</li>
<li><p>source1_usb_dec_infer_resnet_int8.txt：演示一台USB摄像机作为输入。</p>
</li>
<li><p>source1_csi_dec_infer_resnet_int8.txt：演示一个CSI摄像机作为输入；仅限于Jetson。</p>
</li>
<li><p>source2_csi_usb_dec_infer_resnet_int8.txt：演示一台CSI摄像机和一台USB摄像机作为输入；仅限于Jetson。</p>
</li>
<li><p>source6_csi_dec_infer_resnet_int8.txt：演示六个CSI摄像机作为输入；仅限于Jetson。</p>
</li>
<li><p>source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt：演示8解码+推断+跟踪器；仅适用于Jetson Nano。</p>
</li>
<li><p>source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_tx1.txt：演示8解码+推断+跟踪器；仅适用于Jetson TX1。</p>
</li>
<li><p>source12_1080p_dec_infer-resnet_tracker_tiled_display_fp16_tx2.txt：演示12个解码+推断+跟踪器；仅适用于Jetson TX2。</p>
</li>
</ul>
<h2 id="视频输入"><a href="#视频输入" class="headerlink" title="视频输入"></a>视频输入</h2><ul>
<li>默认测试视频</li>
</ul>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br></pre></td><td class="code"><pre><span class="line">[application]</span><br><span class="line">enable-perf-measurement=1</span><br><span class="line">perf-measurement-interval-sec=5</span><br><span class="line"><span class="comment">#gie-kitti-output-dir=streamscl</span></span><br><span class="line"></span><br><span class="line">[tiled-display]</span><br><span class="line"><span class="built_in">enable</span>=0</span><br><span class="line">rows=1</span><br><span class="line">columns=1</span><br><span class="line">width=1280</span><br><span class="line">height=720</span><br><span class="line">gpu-id=0</span><br><span class="line"><span class="comment">#(0): nvbuf-mem-default - Default memory allocated, specific to particular platform</span></span><br><span class="line"><span class="comment">#(1): nvbuf-mem-cuda-pinned - Allocate Pinned/Host cuda memory, applicable for Tesla</span></span><br><span class="line"><span class="comment">#(2): nvbuf-mem-cuda-device - Allocate Device cuda memory, applicable for Tesla</span></span><br><span class="line"><span class="comment">#(3): nvbuf-mem-cuda-unified - Allocate Unified cuda memory, applicable for Tesla</span></span><br><span class="line"><span class="comment">#(4): nvbuf-mem-surface-array - Allocate Surface Array memory, applicable for Jetson</span></span><br><span class="line">nvbuf-memory-type=0</span><br><span class="line"></span><br><span class="line">[source0]</span><br><span class="line"><span class="built_in">enable</span>=1</span><br><span class="line"><span class="comment">#Type - 1=CameraV4L2 2=URI 3=MultiURI</span></span><br><span class="line"><span class="built_in">type</span>=2</span><br><span class="line">uri=file:/opt/nvidia/deepstream/deepstream-6.0/samples/streams/sample_1080p_h264.mp4</span><br><span class="line"><span class="comment">#uri=file:/home/nvidia/Documents/5-Materials/Videos/0825.avi</span></span><br><span class="line">num-sources=1</span><br><span class="line">gpu-id=0</span><br><span class="line"><span class="comment"># (0): memtype_device   - Memory type Device</span></span><br><span class="line"><span class="comment"># (1): memtype_pinned   - Memory type Host Pinned</span></span><br><span class="line"><span class="comment"># (2): memtype_unified  - Memory type Unified</span></span><br><span class="line">cudadec-memtype=0</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">[sink0]</span><br><span class="line"><span class="built_in">enable</span>=1</span><br><span class="line"><span class="comment">#Type - 1=FakeSink 2=EglSink 3=File</span></span><br><span class="line"><span class="built_in">type</span>=2</span><br><span class="line"><span class="built_in">sync</span>=0</span><br><span class="line">source-id=0</span><br><span class="line">gpu-id=0</span><br><span class="line">nvbuf-memory-type=0</span><br><span class="line"><span class="comment">#1=mp4 2=mkv</span></span><br><span class="line">container=1</span><br><span class="line"><span class="comment">#1=h264 2=h265</span></span><br><span class="line">codec=1</span><br><span class="line">output-file=yolov4.mp4</span><br><span class="line"></span><br><span class="line">[osd]</span><br><span class="line"><span class="built_in">enable</span>=1</span><br><span class="line">gpu-id=0</span><br><span class="line">border-width=1</span><br><span class="line">text-size=12</span><br><span class="line">text-color=1;1;1;1;</span><br><span class="line">text-bg-color=0.3;0.3;0.3;1</span><br><span class="line">font=Serif</span><br><span class="line">show-clock=0</span><br><span class="line">clock-x-offset=800</span><br><span class="line">clock-y-offset=820</span><br><span class="line">clock-text-size=12</span><br><span class="line">clock-color=1;0;0;0</span><br><span class="line">nvbuf-memory-type=0</span><br><span class="line"></span><br><span class="line">[streammux]</span><br><span class="line">gpu-id=0</span><br><span class="line"><span class="comment">##Boolean property to inform muxer that sources are live</span></span><br><span class="line">live-source=0</span><br><span class="line">batch-size=4</span><br><span class="line"><span class="comment">##time out in usec, to wait after the first buffer is available</span></span><br><span class="line"><span class="comment">##to push the batch even if the complete batch is not formed</span></span><br><span class="line">batched-push-timeout=40000</span><br><span class="line"><span class="comment">## Set muxer output width and height</span></span><br><span class="line">width=1280</span><br><span class="line">height=720</span><br><span class="line"><span class="comment">##Enable to maintain aspect ratio wrt source, and allow black borders, works</span></span><br><span class="line"><span class="comment">##along with width, height properties</span></span><br><span class="line">enable-padding=0</span><br><span class="line">nvbuf-memory-type=0</span><br><span class="line"></span><br><span class="line"><span class="comment"># config-file property is mandatory for any gie section.</span></span><br><span class="line"><span class="comment"># Other properties are optional and if set will override the properties set in</span></span><br><span class="line"><span class="comment"># the infer config file.</span></span><br><span class="line">[primary-gie]</span><br><span class="line"><span class="built_in">enable</span>=1</span><br><span class="line">gpu-id=0</span><br><span class="line">model-engine-file=yolov5s.engine</span><br><span class="line">labelfile-path=labels.txt</span><br><span class="line"><span class="comment">#batch-size=1</span></span><br><span class="line"><span class="comment">#Required by the app for OSD, not a plugin property</span></span><br><span class="line">bbox-border-color0=1;0;0;1</span><br><span class="line">bbox-border-color1=0;1;1;1</span><br><span class="line">bbox-border-color2=0;0;1;1</span><br><span class="line">bbox-border-color3=0;1;0;1</span><br><span class="line">interval=0</span><br><span class="line">gie-unique-id=1</span><br><span class="line">nvbuf-memory-type=0</span><br><span class="line">config-file=config_infer_primary_yoloV5.txt</span><br><span class="line"></span><br><span class="line">[tracker]</span><br><span class="line"><span class="built_in">enable</span>=0</span><br><span class="line">tracker-width=512</span><br><span class="line">tracker-height=320</span><br><span class="line">ll-lib-file=/opt/nvidia/deepstream/deepstream-5.0/lib/libnvds_mot_klt.so</span><br><span class="line"></span><br><span class="line">[tests]</span><br><span class="line">file-loop=0</span><br></pre></td></tr></table></figure>



<h4 id="camera"><a href="#camera" class="headerlink" title="camera"></a>camera</h4><ul>
<li>USB摄像头</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI</span><br><span class="line">type=1</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br><span class="line">camera-v4l2-dev-node=0</span><br></pre></td></tr></table></figure>

<ul>
<li>CSI摄像头</li>
</ul>
<img src="https://yqypicbed.oss-cn-hangzhou.aliyuncs.com/typoraoss/image-20220309232709200.png" alt="image-20220309232709200" style="zoom:50%;" />

<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI</span><br><span class="line">type=5</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br><span class="line">camera-csi-sensor-id=0</span><br></pre></td></tr></table></figure>

<h4 id="videofile"><a href="#videofile" class="headerlink" title="videofile"></a>videofile</h4><p>4个相同文件，用MultiURI</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP</span><br><span class="line">type=3</span><br><span class="line">uri=file://../../streams/sample_1080p_h264.mp4</span><br><span class="line">num-sources=4</span><br><span class="line">#drop-frame-interval=2</span><br><span class="line">gpu-id=0</span><br><span class="line"># (0): memtype_device   - Memory type Device</span><br><span class="line"># (1): memtype_pinned   - Memory type Host Pinned</span><br><span class="line"># (2): memtype_unified  - Memory type Unified</span><br><span class="line">cudadec-memtype=0</span><br></pre></td></tr></table></figure>

<h4 id="media-stream"><a href="#media-stream" class="headerlink" title="media stream"></a>media stream</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP</span><br><span class="line">type=4</span><br><span class="line">uri=rtsp://admin:admin123@192.168.1.106:554/cam/realmonitor?channel=1&amp;subtype=0</span><br><span class="line">num-sources=1</span><br><span class="line">#drop-frame-interval=2</span><br><span class="line">gpu-id=0</span><br><span class="line"># (0): memtype_device   - Memory type Device</span><br><span class="line"># (1): memtype_pinned   - Memory type Host Pinned</span><br><span class="line"># (2): memtype_unified  - Memory type Unified</span><br><span class="line">cudadec-memtype=0</span><br></pre></td></tr></table></figure>

<h4 id="多路USB"><a href="#多路USB" class="headerlink" title="多路USB"></a>多路USB</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP</span><br><span class="line">type=3</span><br><span class="line">uri=file://../../streams/sample_1080p_h264.mp4</span><br><span class="line">num-sources=4</span><br><span class="line">#drop-frame-interval=2</span><br><span class="line">gpu-id=0</span><br><span class="line"># (0): memtype_device   - Memory type Device</span><br><span class="line"># (1): memtype_pinned   - Memory type Host Pinned</span><br><span class="line"># (2): memtype_unified  - Memory type Unified</span><br><span class="line">cudadec-memtype=0</span><br></pre></td></tr></table></figure>

<h4 id="多路CSI"><a href="#多路CSI" class="headerlink" title="多路CSI"></a>多路CSI</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line">[source0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI</span><br><span class="line">type=5</span><br><span class="line">camera-csi-sensor-id=0</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br><span class="line"></span><br><span class="line">[source1]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI</span><br><span class="line">type=5</span><br><span class="line">camera-csi-sensor-id=1</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br><span class="line"></span><br><span class="line">[source2]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI</span><br><span class="line">type=5</span><br><span class="line">camera-csi-sensor-id=2</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br><span class="line"></span><br><span class="line">[source3]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI</span><br><span class="line">type=5</span><br><span class="line">camera-csi-sensor-id=3</span><br><span class="line">camera-width=1280</span><br><span class="line">camera-height=720</span><br><span class="line">camera-fps-n=30</span><br><span class="line">camera-fps-d=1</span><br></pre></td></tr></table></figure>



<h2 id="视频处理"><a href="#视频处理" class="headerlink" title="视频处理"></a>视频处理</h2><h4 id="物体检测"><a href="#物体检测" class="headerlink" title="物体检测"></a>物体检测</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br></pre></td><td class="code"><pre><span class="line"># config-file property is mandatory for any gie section.</span><br><span class="line"># Other properties are optional and if set will override the properties set in</span><br><span class="line"># the infer config file.</span><br><span class="line">[primary-gie]</span><br><span class="line">enable=1</span><br><span class="line">model-engine-file=../../models/Primary_Detector/resnet10.caffemodel_b30_int8.engine</span><br><span class="line">#Required to display the PGIE labels, should be added even when using config-file</span><br><span class="line">#property</span><br><span class="line">batch-size=4</span><br><span class="line">#Required by the app for OSD, not a plugin property</span><br><span class="line">bbox-border-color0=1;0;0;1</span><br><span class="line">bbox-border-color1=0;1;1;1</span><br><span class="line">bbox-border-color2=0;0;1;1</span><br><span class="line">bbox-border-color3=0;1;0;1</span><br><span class="line">interval=0</span><br><span class="line">#Required by the app for SGIE, when used along with config-file property</span><br><span class="line">gie-unique-id=1</span><br><span class="line">config-file=config_infer_primary.txt</span><br></pre></td></tr></table></figure>

<h4 id="物体跟踪"><a href="#物体跟踪" class="headerlink" title="物体跟踪"></a>物体跟踪</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre></td><td class="code"><pre><span class="line">[tracker]</span><br><span class="line">enable=1</span><br><span class="line">tracker-width=640</span><br><span class="line">tracker-height=368</span><br><span class="line">#tracker-width=480</span><br><span class="line">#tracker-height=272</span><br><span class="line"></span><br><span class="line">#ll-lib-file=/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_mot_iou.so</span><br><span class="line">#ll-lib-file=/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_nvdcf.so</span><br><span class="line">ll-lib-file=/opt/nvidia/deepstream/deepstream-4.0/lib/libnvds_mot_klt.so</span><br><span class="line">#ll-config-file required for DCF/IOU only</span><br><span class="line">#ll-config-file=tracker_config.yml</span><br><span class="line">#ll-config-file=iou_config.txt</span><br><span class="line">gpu-id=0</span><br><span class="line">#enable-batch-process applicable to DCF only</span><br><span class="line">enable-batch-process=1</span><br></pre></td></tr></table></figure>

<h4 id="检测后的具体分类"><a href="#检测后的具体分类" class="headerlink" title="检测后的具体分类"></a>检测后的具体分类</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br></pre></td><td class="code"><pre><span class="line">[secondary-gie0]</span><br><span class="line">enable=1</span><br><span class="line">model-engine-file=../../models/Secondary_VehicleTypes/resnet18.caffemodel_b16_int8.engine</span><br><span class="line">gpu-id=0</span><br><span class="line">batch-size=16</span><br><span class="line">gie-unique-id=4</span><br><span class="line">operate-on-gie-id=1</span><br><span class="line">operate-on-class-ids=0;</span><br><span class="line">config-file=config_infer_secondary_vehicletypes.txt</span><br><span class="line"></span><br><span class="line">[secondary-gie1]</span><br><span class="line">enable=1</span><br><span class="line">model-engine-file=../../models/Secondary_CarColor/resnet18.caffemodel_b16_int8.engine</span><br><span class="line">batch-size=16</span><br><span class="line">gpu-id=0</span><br><span class="line">gie-unique-id=5</span><br><span class="line">operate-on-gie-id=1</span><br><span class="line">operate-on-class-ids=0;</span><br><span class="line">config-file=config_infer_secondary_carcolor.txt</span><br><span class="line"></span><br><span class="line">[secondary-gie2]</span><br><span class="line">enable=1</span><br><span class="line">model-engine-file=../../models/Secondary_CarMake/resnet18.caffemodel_b16_int8.engine</span><br><span class="line">batch-size=16</span><br><span class="line">gpu-id=0</span><br><span class="line">gie-unique-id=6</span><br><span class="line">operate-on-gie-id=1</span><br><span class="line">operate-on-class-ids=0;</span><br><span class="line">config-file=config_infer_secondary_carmake.txt</span><br></pre></td></tr></table></figure>



<h2 id="视频输出"><a href="#视频输出" class="headerlink" title="视频输出"></a>视频输出</h2><h4 id="多路合并"><a href="#多路合并" class="headerlink" title="多路合并"></a>多路合并</h4><p>单路</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">[tiled-display]</span><br><span class="line">enable=1</span><br><span class="line">rows=1</span><br><span class="line">columns=1</span><br><span class="line">width=1280</span><br><span class="line">height=720</span><br></pre></td></tr></table></figure>

<p>多路</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line">[tiled-display]</span><br><span class="line">enable=1</span><br><span class="line">rows=4</span><br><span class="line">columns=2</span><br><span class="line">width=1280</span><br><span class="line">height=720</span><br><span class="line">gpu-id=0</span><br><span class="line">#(0): nvbuf-mem-default - Default memory allocated, specific to particular platform</span><br><span class="line">#(1): nvbuf-mem-cuda-pinned - Allocate Pinned/Host cuda memory, applicable for Tesla</span><br><span class="line">#(2): nvbuf-mem-cuda-device - Allocate Device cuda memory, applicable for Tesla</span><br><span class="line">#(3): nvbuf-mem-cuda-unified - Allocate Unified cuda memory, applicable for Tesla</span><br><span class="line">#(4): nvbuf-mem-surface-array - Allocate Surface Array memory, applicable for Jetson</span><br><span class="line">nvbuf-memory-type=0</span><br></pre></td></tr></table></figure>

<h4 id="screen"><a href="#screen" class="headerlink" title="screen"></a>screen</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">[sink0]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming 5=Overlay</span><br><span class="line">type=5</span><br><span class="line">sync=0</span><br><span class="line">display-id=0</span><br><span class="line">offset-x=0</span><br><span class="line">offset-y=0</span><br><span class="line">width=0</span><br><span class="line">height=0</span><br><span class="line">overlay-id=1</span><br><span class="line">source-id=0</span><br></pre></td></tr></table></figure>

<h4 id="videofile-1"><a href="#videofile-1" class="headerlink" title="videofile"></a>videofile</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">[sink1]</span><br><span class="line">enable=1</span><br><span class="line">type=3</span><br><span class="line">#1=mp4 2=mkv</span><br><span class="line">container=1</span><br><span class="line">#1=h264 2=h265 3=mpeg4</span><br><span class="line">codec=1</span><br><span class="line">sync=0</span><br><span class="line">bitrate=2000000</span><br><span class="line">output-file=out.mp4</span><br><span class="line">source-id=0</span><br></pre></td></tr></table></figure>

<h4 id="media-stream-1"><a href="#media-stream-1" class="headerlink" title="media stream"></a>media stream</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">[sink2]</span><br><span class="line">enable=1</span><br><span class="line">#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming 5=Overlay</span><br><span class="line">type=4</span><br><span class="line">#1=h264 2=h265</span><br><span class="line">codec=1</span><br><span class="line">sync=0</span><br><span class="line">bitrate=4000000</span><br><span class="line"># set below properties in case of RTSPStreaming</span><br><span class="line">rtsp-port=8554</span><br><span class="line">udp-port=5400</span><br></pre></td></tr></table></figure>

<p>vlc打开网络流 rtsp:&#x2F;&#x2F;192.168.0.118:8554&#x2F;ds-test</p>
<h4 id="osd"><a href="#osd" class="headerlink" title="osd"></a>osd</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">[osd]</span><br><span class="line">enable=1</span><br><span class="line">border-width=2</span><br><span class="line">text-size=15</span><br><span class="line">text-color=1;1;1;1;</span><br><span class="line">text-bg-color=0.3;0.3;0.3;1</span><br><span class="line">font=Serif</span><br><span class="line">show-clock=0</span><br><span class="line">clock-x-offset=800</span><br><span class="line">clock-y-offset=820</span><br><span class="line">clock-text-size=12</span><br><span class="line">clock-color=1;0;0;0</span><br></pre></td></tr></table></figure>

<h4 id="streammux"><a href="#streammux" class="headerlink" title="streammux"></a>streammux</h4><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line">[streammux]</span><br><span class="line">##Boolean property to inform muxer that sources are live</span><br><span class="line">live-source=1</span><br><span class="line">## 根据路数进行设置</span><br><span class="line">batch-size=4</span><br><span class="line">##time out in usec, to wait after the first buffer is available</span><br><span class="line">##to push the batch even if the complete batch is not formed</span><br><span class="line">batched-push-timeout=40000</span><br><span class="line">## Set muxer output width and height</span><br><span class="line">width=1280</span><br><span class="line">height=720</span><br></pre></td></tr></table></figure>



<h2 id="Sample例程"><a href="#Sample例程" class="headerlink" title="Sample例程"></a>Sample例程</h2><ul>
<li>DeepStream Sample App &#x2F;sources&#x2F;apps&#x2F;sample_apps&#x2F;deepstream-app</li>
</ul>
<blockquote>
<p>说明:端到端示例演示了4级联神经网络(1个一级检测器和3个二级分类器)的多相机流，并显示平铺输出。</p>
</blockquote>
<ul>
<li><p>DeepStream Test 1 &#x2F;sources&#x2F;apps&#x2F;sample_apps&#x2F;deepstream-t</p>
</li>
<li><p>DeepStream Test 2 &#x2F;sources&#x2F;apps&#x2F;sample_apps&#x2F;deepstream-test2</p>
</li>
</ul>
<blockquote>
<p>说明:简单的应用程序，建立在test1之上，显示额外的属性，如跟踪和二级分类属性。</p>
</blockquote>
<ul>
<li>DeepStream Test 3 &#x2F;sources&#x2F;apps&#x2F;sample_apps&#x2F;deepstream-test3</li>
</ul>
<blockquote>
<p>说明:简单的应用程序，建立在test1的基础上，显示多个输入源和批处理使用nvstreammuxer。</p>
</blockquote>
<ul>
<li>DeepStream Test 4 &#x2F;sources&#x2F;apps&#x2F;sample_apps&#x2F;deepstream-test4</li>
</ul>
<blockquote>
<p>说明:这是在Test1示例的基础上构建的，演示了“nvmsgconv”和“nvmsgbroker”插件在物联网连接管道中的使用。对于test4，用户必须修改kafka代理连接字符串才能成功连接。需要安装分析服务器docker之前运行test4。DeepStream分析文档有关于设置分析服务器的更多信息。</p>
</blockquote>
<ul>
<li>FasterRCNN Object Detector &#x2F;sources&#x2F;objectDetector_FasterRCNN</li>
</ul>
<blockquote>
<p>说明:FasterRCNN物体探测器实例。</p>
</blockquote>
<ul>
<li>SSD Object Detector &#x2F;sources&#x2F;objectDetector_SSD</li>
</ul>
<blockquote>
<p>说明:SSD目标探测器实例。</p>
</blockquote>
<h1 id="部署自己的模型"><a href="#部署自己的模型" class="headerlink" title="部署自己的模型"></a>部署自己的模型</h1><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/ailaier/article/details/116270962">Jetson nano上部署自己的Yolov5模型（TensorRT加速）_ailaier的专栏-CSDN博客_jetson nano yolov5</a></p>
<h1 id="References"><a href="#References" class="headerlink" title="References"></a>References</h1><h2 id="部署"><a href="#部署" class="headerlink" title="部署"></a>部署</h2><ul>
<li><p><a target="_blank" rel="noopener" href="https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_custom_YOLO.html">Custom YOLO Model in the DeepStream YOLO App — DeepStream 6.0 Release documentation (nvidia.com)</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/sshheennddee123/article/details/121060158">Jetson nano部署过程记录：yolov5s+TensorRT+Deepstream检测usb摄像头_sshheennddee123的博客-CSDN博客</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://www.bilibili.com/read/cv11869887">Jetson nano从烧录系统到DeepStream+TensorRT+yolov5检测CSI摄像头视频 - 哔哩哔哩 (bilibili.com)</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/ailaier/article/details/116270962">Jetson nano上部署自己的Yolov5模型（TensorRT加速）_ailaier的专栏-CSDN博客_jetson nano yolov5</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/rscgg37248/DeepStream6.0_Yolov5-6.0">rscgg37248&#x2F;DeepStream6.0_Yolov5-6.0: 基于DeepStream6.0和yolov5-6.0的目标检测 (github.com)</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/391513840">NVIDIA Jetson Nano 2GB 系列文章（30）：DeepStream 摄像头“实时性能” - 知乎 (zhihu.com)</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/ailaier/article/details/116270962"> Jetson nano上部署自己的Yolov5模型（TensorRT加速）_ailaier的专栏-CSDN博客_jetson nano yolov5</a></p>
</li>
</ul>
<h2 id="deepstream"><a href="#deepstream" class="headerlink" title="deepstream"></a>deepstream</h2><ul>
<li><p><a target="_blank" rel="noopener" href="https://docs.nvidia.com/metropolis/deepstream/4.0/dev-guide/index.html#page/DeepStream_Development_Guide%2Fdeepstream_app_config.3.2.html%23wwpID0E0WB0HA">DeepStream Development Guide (nvidia.com)</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="http://openjetson.com/index.php/2020/12/21/deepstream/">Deepstream使用 – OpenJetson</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://cloud.tencent.com/developer/article/1524712">关于NVIDIA Deepstream SDK压箱底的资料都在这里了 - 云+社区 - 腾讯云 (tencent.com)</a></p>
</li>
</ul>

                
            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        Author:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="/about" rel="external nofollow noreferrer">yinqiyu</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        Link:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="http://example.com/2024/02/13/2.%20yolov5-tensorrt-deepstream/">http://example.com/2024/02/13/2.%20yolov5-tensorrt-deepstream/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        Reprint policy:
                    </i>
                </span>
                <span class="reprint-info">
                    All articles in this blog are used except for special statements
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    reprint policy. If reproduced, please indicate source
                    <a href="/about" target="_blank">yinqiyu</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>Copied successfully, please follow the reprint policy of this article</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">more</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            <span class="chip bg-color">No tag</span>
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/libs/share/css/share.min.css">
<div id="article-share">

    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
                <div id="reward">
    <a href="#rewardModal" class="reward-link modal-trigger btn-floating btn-medium waves-effect waves-light red">赏</a>

    <!-- Modal Structure -->
    <div id="rewardModal" class="modal">
        <div class="modal-content">
            <a class="close modal-close"><i class="fas fa-times"></i></a>
            <h4 class="reward-title">你的赏识是我前进的动力</h4>
            <div class="reward-content">
                <div class="reward-tabs">
                    <ul class="tabs row">
                        <li class="tab col s6 alipay-tab waves-effect waves-light"><a href="#alipay">支付宝</a></li>
                        <li class="tab col s6 wechat-tab waves-effect waves-light"><a href="#wechat">微 信</a></li>
                    </ul>
                    <div id="alipay">
                        <img src="/medias/reward/alipay.jpg" class="reward-img" alt="支付宝打赏二维码">
                    </div>
                    <div id="wechat">
                        <img src="/medias/reward/wechat.png" class="reward-img" alt="微信打赏二维码">
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        $('.tabs').tabs();
    });
</script>

            
        </div>
    </div>

    

    

    

    

    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;Previous</div>
            <div class="card">
                <a href="/2024/02/14/3-issue/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/18.jpg" class="responsive-img" alt="3.issue">
                        
                        <span class="card-title">3.issue</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2024-02-14
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-user fa-fw"></i>
                            yinqiyu
                            
                        </span>
                    </div>
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                Next&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/2024/02/13/1.%20EnvironmentConfiguration/">
                    <div class="card-image">
                        
                        
                        <img src="/medias/featureimages/0.jpg" class="responsive-img" alt="1.EnvironmentConfiguration">
                        
                        <span class="card-title">1.EnvironmentConfiguration</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2024-02-13
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-user fa-fw"></i>
                            yinqiyu
                            
                        </span>
                    </div>
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>



<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/libs/codeBlock/codeBlockFuction.js"></script>



<!-- 代码语言 -->

<script type="text/javascript" src="/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/libs/codeBlock/codeShrink.js"></script>



    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget card" style="background-color: white;">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;TOC</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4'
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>




    <footer class="page-footer bg-color">
    
        <link rel="stylesheet" href="/libs/aplayer/APlayer.min.css">
<style>
    .aplayer .aplayer-lrc p {
        
        display: none;
        
        font-size: 12px;
        font-weight: 700;
        line-height: 16px !important;
    }

    .aplayer .aplayer-lrc p.aplayer-lrc-current {
        
        display: none;
        
        font-size: 15px;
        color: #42b983;
    }

    
    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
        left: -66px !important;
    }

    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body:hover {
        left: 0px !important;
    }

    
</style>
<div class="">
    
    <div class="row">
        <meting-js class="col l8 offset-l2 m10 offset-m1 s12"
                   server="netease"
                   type="playlist"
                   id="503838841"
                   fixed='true'
                   autoplay='false'
                   theme='#42b983'
                   loop='all'
                   order='random'
                   preload='auto'
                   volume='0.7'
                   list-folded='true'
        >
        </meting-js>
    </div>
</div>

<script src="/libs/aplayer/APlayer.min.js"></script>
<script src="/libs/aplayer/Meting.min.js"></script>

    

    <div class="container row center-align"
         style="margin-bottom: 0px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            
                <span id="year">2019-2024</span>
            
            <a href="/about" target="_blank">yinqiyu</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            
            <br>
            
            
            
                
            
            
                <span id="busuanzi_container_site_pv">
                &nbsp;|&nbsp;<i class="far fa-eye"></i>&nbsp;Total visits:&nbsp;
                    <span id="busuanzi_value_site_pv" class="white-color"></span>
            </span>
            
            
                <span id="busuanzi_container_site_uv">
                &nbsp;|&nbsp;<i class="fas fa-users"></i>&nbsp;Total visitors:&nbsp;
                    <span id="busuanzi_value_site_uv" class="white-color"></span>
            </span>
            
            <br>

            <!-- 运行天数提醒. -->
            
            <br>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/blinkfox" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:1181062873@qq.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=1181062873" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 1181062873" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>







    <a href="/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50">
        <i class="fas fa-rss"></i>
    </a>

</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;Search</span>
            <input type="search" id="searchInput" name="s" placeholder="Please enter a search keyword"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script type="text/javascript">
$(function () {
    var searchFunc = function (path, search_id, content_id) {
        'use strict';
        $.ajax({
            url: path,
            dataType: "xml",
            success: function (xmlResponse) {
                // get the contents from search data
                var datas = $("entry", xmlResponse).map(function () {
                    return {
                        title: $("title", this).text(),
                        content: $("content", this).text(),
                        url: $("url", this).text()
                    };
                }).get();
                var $input = document.getElementById(search_id);
                var $resultContent = document.getElementById(content_id);
                $input.addEventListener('input', function () {
                    var str = '<ul class=\"search-result-list\">';
                    var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
                    $resultContent.innerHTML = "";
                    if (this.value.trim().length <= 0) {
                        return;
                    }
                    // perform local searching
                    datas.forEach(function (data) {
                        var isMatch = true;
                        var data_title = data.title.trim().toLowerCase();
                        var data_content = data.content.trim().replace(/<[^>]+>/g, "").toLowerCase();
                        var data_url = data.url;
                        data_url = data_url.indexOf('/') === 0 ? data.url : '/' + data_url;
                        var index_title = -1;
                        var index_content = -1;
                        var first_occur = -1;
                        // only match artiles with not empty titles and contents
                        if (data_title !== '' && data_content !== '') {
                            keywords.forEach(function (keyword, i) {
                                index_title = data_title.indexOf(keyword);
                                index_content = data_content.indexOf(keyword);
                                if (index_title < 0 && index_content < 0) {
                                    isMatch = false;
                                } else {
                                    if (index_content < 0) {
                                        index_content = 0;
                                    }
                                    if (i === 0) {
                                        first_occur = index_content;
                                    }
                                }
                            });
                        }
                        // show search results
                        if (isMatch) {
                            str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>";
                            var content = data.content.trim().replace(/<[^>]+>/g, "");
                            if (first_occur >= 0) {
                                // cut out 100 characters
                                var start = first_occur - 20;
                                var end = first_occur + 80;
                                if (start < 0) {
                                    start = 0;
                                }
                                if (start === 0) {
                                    end = 100;
                                }
                                if (end > content.length) {
                                    end = content.length;
                                }
                                var match_content = content.substr(start, end);
                                // highlight all keywords
                                keywords.forEach(function (keyword) {
                                    var regS = new RegExp(keyword, "gi");
                                    match_content = match_content.replace(regS, "<em class=\"search-keyword\">" + keyword + "</em>");
                                });

                                str += "<p class=\"search-result\">" + match_content + "...</p>"
                            }
                            str += "</li>";
                        }
                    });
                    str += "</ul>";
                    $resultContent.innerHTML = str;
                });
            }
        });
    };

    searchFunc('/search.xml', 'searchInput', 'searchResult');
});
</script>

    <!-- 白天和黑夜主题 -->
<div class="stars-con">
    <div id="stars"></div>
    <div id="stars2"></div>
    <div id="stars3"></div>  
</div>

<script>
    function switchNightMode() {
        $('<div class="Cuteen_DarkSky"><div class="Cuteen_DarkPlanet"></div></div>').appendTo($('body')),
        setTimeout(function () {
            $('body').hasClass('DarkMode') 
            ? ($('body').removeClass('DarkMode'), localStorage.setItem('isDark', '0'), $('#sum-moon-icon').removeClass("fa-sun").addClass('fa-moon')) 
            : ($('body').addClass('DarkMode'), localStorage.setItem('isDark', '1'), $('#sum-moon-icon').addClass("fa-sun").removeClass('fa-moon')),
            
            setTimeout(function () {
            $('.Cuteen_DarkSky').fadeOut(1e3, function () {
                $(this).remove()
            })
            }, 2e3)
        })
    }
</script>

    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/libs/materialize/materialize.min.js"></script>
    <script src="/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/libs/aos/aos.js"></script>
    <script src="/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/js/matery.js"></script>

    

    
    
    

    <!-- 雪花特效 -->
    

    <!-- 鼠标星星特效 -->
    

     
        <script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
        <script src="/libs/others/TencentCaptcha.js"></script>
        <button id="TencentCaptcha" data-appid="xxxxxxxxxx" data-cbfn="callback" type="button" hidden></button>
    

    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    <!--腾讯兔小巢-->
    
    

    

    

    
    <script src="/libs/instantpage/instantpage.js" type="module"></script>
    

</body>

</html>
